//
//  AddThreeButtonView.m
//  LoveTrail
//
//  Created by giantumbrella on 15/6/11.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//

#import "AddThreeButtonView.h"
#import "CommonMacro.h"

@interface AddThreeButtonView()
//@property (nonatomic,strong) UIView *trailLine;
//@property (nonatomic,strong) UIView *orderLine;
//@property (nonatomic,strong) UIView *aboutourLine;

@end
@implementation AddThreeButtonView

-(id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self addSubViews];

    }
    return self;
}

#pragma mark 添加三个button
- (void)addSubViews
{
    CGFloat buttonY = SCREEN_HEIGHT*0.1;
    CGFloat viewY = buttonY-2;
    //1.试用
    UIButton *trailButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3, buttonY)];
    trailButton.tag = 100;
    [trailButton setImage:[UIImage imageNamed:@"trail"] forState:UIControlStateNormal];
//    [trailButton setImage:[UIImage imageNamed:@"trail-ed"] forState:UIControlStateSelected];
    trailButton.selected = YES;
    self.lastBtn = trailButton;
    self.trailLine = [[UIView alloc] initWithFrame:CGRectMake(trailButton.frame.size.width*0.3, viewY, trailButton.frame.size.width*0.36, 2)];
    self.trailLine.backgroundColor = UIColorWithRGBA(247, 128, 0, 1);
    self.trailLine.hidden = NO;
    self.lastView.hidden = self.trailLine;
    [self addSubview:self.trailLine];
    
    [self addSubview:trailButton];
    [trailButton addTarget:self action:@selector(clickButtonChangeView:) forControlEvents:UIControlEventTouchUpInside];
    
    //2.我的订单
    UIButton *orderButton = [[UIButton alloc] initWithFrame:CGRectMake(trailButton.frame.size.width+trailButton.frame.origin.x, 0, SCREEN_WIDTH/3, buttonY)];
    orderButton.tag = 101;
    [orderButton setImage:[UIImage imageNamed:@"myorder"] forState:UIControlStateNormal];
    [self addSubview:orderButton];
    [orderButton addTarget:self action:@selector(clickButtonChangeView:) forControlEvents:UIControlEventTouchUpInside];
    self.orderLine = [[UIView alloc] initWithFrame:CGRectMake(orderButton.frame.size.width*0.3+orderButton.frame.size.width*1, viewY, trailButton.frame.size.width*0.39, 2)];
    self.orderLine.backgroundColor = UIColorWithRGBA(238, 31, 0, 1);
    self.orderLine.hidden = YES;
    [self addSubview:self.orderLine];
    
    //3.关于我们
    UIButton *aboutOurButton = [[UIButton alloc] initWithFrame:CGRectMake(orderButton.frame.size.width+orderButton.frame.origin.x, 0, SCREEN_WIDTH/3, buttonY)];
    aboutOurButton.tag = 102;
    [aboutOurButton setImage:[UIImage imageNamed:@"aboutour"] forState:UIControlStateNormal];
//    [aboutOurButton setImage:[UIImage imageNamed:@"aboutour-ed"] forState:UIControlStateSelected];
    [self addSubview:aboutOurButton];
    [aboutOurButton addTarget:self action:@selector(clickButtonChangeView:) forControlEvents:UIControlEventTouchUpInside];
    self.aboutourLine = [[UIView alloc] initWithFrame:CGRectMake(aboutOurButton.frame.size.width*0.3+aboutOurButton.frame.size.width*2, viewY, trailButton.frame.size.width*0.39, 2)];
    self.aboutourLine.backgroundColor = UIColorWithRGBA(58, 153, 252, 1);
    self.aboutourLine.hidden = YES;
    [self addSubview:self.aboutourLine];

}

#pragma mark 点击事件
- (void)clickButtonChangeView:(UIButton *)button
{
    if ([self.delegate respondsToSelector:@selector(enterDifferent:)]) {
        [self.delegate enterDifferent:button];
    }
}


@end
